<form class="form-horizontal" name="strategy_form" ng-submit="do_upsert()">
  <div class="modal-header">
    <a class="close" ng-click="close()">&times;</a>
    <div class="input-prepend input-append">
      <h4>{{title}}</h4>
    </div>
  </div>
  <div class="modal-body">
    <div class="control-group">
      <label class="control-label">名称:</label>
      <div class="controls">
        <input type="text" required ng-model="backupstrategy.name" class="input"/>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">备份方式:</label>
      <div class="controls">
        <select required class="span2" ng-model="backupstrategy.backuptype" ng-options="t.name for t in backupTypes">

        </select>

      </div>
    </div>
    <div class="control-group">
      <label class="control-label">压缩:</label>
      <div class="controls">
        <input type="checkbox" class="input-mini" ng-model="backupstrategy.compress" ng-click="compress_click()"/>
        <span ng-show="backupstrategy.compress">级别: <input type="number" min="0" max="9" ng-model="backupstrategy.compresslevel" class="input-small"/></span>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">保留:</label>
      <div class="controls">
        <label class="radio">
          <input type="radio" ng-model="backupstrategy.remain" value="0" ng-click="remain_all()">所有
        </label>
        <label class="radio">
          <input type="radio" ng-model="backupstrategy.remain" value="1" ng-click="remain_days()">保留最后
            <input id="remain_days" ng-model="backupstrategy.remaindays" ng-disabled="remaindays_dis" type="number" min="1" class="input-small"/>天
        </label>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">备份位置:</label>
      <div class="controls">
        <label class="radio">
          <input type="radio" ng-click="location_local()" ng-model="backupstrategy.locationtype" value="0">本地
          <input type="text" ng-disabled="local_dis" ng-model="backupstrategy.localpath" class="input" ng-required="local_req"/>
        </label>
        <label class="radio">
          <input type="radio" ng-click="location_storage()" ng-model="backupstrategy.locationtype" value="1">存储
          <select class="span2" ng-disabled="storage_dis" ng-model="backupstrategy.storage" ng-options="s.name for s in storages" ng-required="storage_req"></select>
          </select>
        </label>
        <label class="radio">
          <input type="radio" ng-click="location_remote()" ng-model="backupstrategy.locationtype" value="3">远程(sftp)<br />
            <table>
                <tr>
                    <td>
                        <label class="control-label" style="width: 50px">主机:</label><input ng-disabled="host_dis" ng-model="backupstrategy.sftphost" type="text" class="input-small" ng-required="host_req"/>
                    </td>
                    <td>
                        <label class="control-label" style="width: 50px">路径:</label><input ng-disabled="path_dis" ng-model="backupstrategy.sftppath" type="text" class="input-small" ng-required="path_req"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label class="control-label" style="width: 50px">用户名:</label><input ng-disabled="username_dis" ng-model="backupstrategy.sftpusername" type="text" class="input-small" ng-required="username_req"/>
                    </td>
                    <td>
                        <label class="control-label" style="width: 50px">密码:</label><input ng-disabled="password_dis" ng-model="backupstrategy.sftppassword" type="password" class="input-small" ng-required="password_req"/>
                    </td>
                </tr>
            </table>
        </label>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">执行频率:</label>
      <div class="controls">
        <select class="span2" id="schedule" ng-model="backupstrategy.backupfrequency" ng-options="s.name for s in schedules" ng-change="schedulechange(schedule)"></select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">执行时间:</label>
        <div id="week" class="controls" ng-show="permissionsweek">
          <select class="span2" ng-model="backupstrategy.week" ng-options="s.name for s in weeks"></select>
          </select>
        </div>
        <div id="day" class="controls" ng-show="permissionsday">
          <select class="span2" ng-model="backupstrategy.day" ng-options="s.name for s in days"></select>
          </select>
        </div>
        <div id="time" class="controls" ng-show="permissionstime">
            <input type="text" id="backuptimer" data-show-meridian="false" required class="input-small" ng-model="backupstrategy.backuptime" bs-timepicker>
            <button type="button" class="btn" data-toggle="timepicker"><i class="icon-time"></i></button>
        </div>
    </div>
  </div>
  <div class="modal-footer">
    <a data-dismiss="modal" class="btn" ng-click="close()">关闭</a>
    <button type="submit" ng-disabled="!strategy_form.$valid" class="btn btn-primary">保存</button>
  </div>
</form>
